package com.nbcio.modules.estar.payrollsum.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.nbcio.modules.estar.payroll.entity.ErpPayrollB;
import com.nbcio.modules.estar.payrollsum.entity.ErpPayrollsumB;
import com.nbcio.modules.estar.payrollsum.mapper.ErpPayrollsumBMapper;
import com.nbcio.modules.estar.payrollsum.service.IErpPayrollsumBService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 工资汇总单子表
 * @Author: nbacheng
 * @Date:   2024-04-28
 * @Version: V1.0
 */
@Service
public class ErpPayrollsumBServiceImpl extends ServiceImpl<ErpPayrollsumBMapper, ErpPayrollsumB> implements IErpPayrollsumBService {

	@Autowired
	private ErpPayrollsumBMapper erpPayrollsumBMapper;

	@Override
	public List<ErpPayrollsumB> selectByMainId(String mainId) {
		return erpPayrollsumBMapper.selectByMainId(mainId);
	}

	@Override
	public JSONArray salarySum(JSONObject obj) {
		Map<String, Object> map=JSONObject.toJavaObject(obj,Map.class);
		List<ErpPayrollsumB> res=erpPayrollsumBMapper.salarySum(map);

		return (res==null || res.size()==0)?null:JSONArray.parseArray(JSON.toJSONString(res));
	}
}
